package principle.liskovSubstitutionPrinciple.perfection;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author： pang-yun
 * @date： 2021-08-24 19:37
 * 功能目的 ：用于  抽象银行卡类
 *
 */

@Data
@AllArgsConstructor
public abstract class BankCard {
    private Logger logger=LoggerFactory.getLogger(BankCard.class);
    private int cardNo;
    private String cardDate;

    public BankCard(int cardNo, String cardDate) {
        this.cardNo = cardNo;
        this.cardDate = cardDate;
    }

    abstract boolean rule(BigDecimal amount);

    //正向加钱
    public String positive(int orderId,BigDecimal amount){
        logger.info("存钱");
        return "0000";
    }
    //反向取钱
    public String negative(int orderId, BigDecimal amount){
        logger.info("取钱");
        return "0000";
    }


    /**
     * 模拟交易流水
     *
     * @return
     */
    public List<String> tradeFlow() {
        logger.info("交易流水查询");
        ArrayList<String> arrayList = new ArrayList<>();
        arrayList.add("100001.100.00");
        arrayList.add("100001.200.00");
        arrayList.add("100001.300.00");
        return arrayList;
    }

}

